home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Microsoft Plateform / Visual Basic 5.0 / Msvb50.ace / msvb50 / MSVB50 / VB / SAMPLES / VISDATA / CPYSTRU.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-11-15  |  7.2 KB  |  232 lines

  1. VERSION 5.00
  2. Begin VB.Form frmCopyStruct 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Copy Structure"
  5.    ClientHeight    =   3300
  6.    ClientLeft      =   1380
  7.    ClientTop       =   1650
  8.    ClientWidth     =   6525
  9.    BeginProperty Font 
  10.       Name            =   "Tahoma"
  11.       Size            =   8.25
  12.       Charset         =   0
  13.       Weight          =   400
  14.       Underline       =   0   'False
  15.       Italic          =   0   'False
  16.       Strikethrough   =   0   'False
  17.    EndProperty
  18.    HelpContextID   =   2016121
  19.    Icon            =   "CPYSTRU.frx":0000
  20.    LinkTopic       =   "Form1"
  21.    LockControls    =   -1  'True
  22.    MaxButton       =   0   'False
  23.    MinButton       =   0   'False
  24.    ScaleHeight     =   2873.239
  25.    ScaleMode       =   0  'User
  26.    ScaleWidth      =   6436.072
  27.    ShowInTaskbar   =   0   'False
  28.    StartUpPosition =   1  'CenterOwner
  29.    Begin VB.CheckBox chkCopyData 
  30.       Caption         =   "Copy Data   "
  31.       Height          =   255
  32.       Left            =   3120
  33.       MaskColor       =   &H00000000&
  34.       TabIndex        =   9
  35.       Top             =   2160
  36.       Width           =   3135
  37.    End
  38.    Begin VB.TextBox txtDatabase 
  39.       BackColor       =   &H00FFFFFF&
  40.       Height          =   285
  41.       Left            =   3045
  42.       TabIndex        =   1
  43.       Top             =   420
  44.       Width           =   3375
  45.    End
  46.    Begin VB.CommandButton cmdClose 
  47.       Cancel          =   -1  'True
  48.       Caption         =   "&Close"
  49.       Height          =   375
  50.       Left            =   4800
  51.       MaskColor       =   &H00000000&
  52.       TabIndex        =   4
  53.       Top             =   2730
  54.       Width           =   1575
  55.    End
  56.    Begin VB.CommandButton cmdOK 
  57.       Caption         =   "&OK"
  58.       Default         =   -1  'True
  59.       Height          =   375
  60.       Left            =   3000
  61.       MaskColor       =   &H00000000&
  62.       TabIndex        =   3
  63.       Top             =   2730
  64.       Width           =   1575
  65.    End
  66.    Begin VB.TextBox txtConnect 
  67.       BackColor       =   &H00FFFFFF&
  68.       Height          =   540
  69.       Left            =   3045
  70.       MultiLine       =   -1  'True
  71.       TabIndex        =   0
  72.       Top             =   1155
  73.       Width           =   3375
  74.    End
  75.    Begin VB.CheckBox chkCopyIndexes 
  76.       Caption         =   "Copy Indexes"
  77.       Height          =   255
  78.       Left            =   3120
  79.       MaskColor       =   &H00000000&
  80.       TabIndex        =   2
  81.       Top             =   1800
  82.       Value           =   1  'Checked
  83.       Width           =   3165
  84.    End
  85.    Begin VB.ListBox lstTables 
  86.       BackColor       =   &H00FFFFFF&
  87.       Height          =   2430
  88.       Left            =   105
  89.       MultiSelect     =   2  'Extended
  90.       Sorted          =   -1  'True
  91.       TabIndex        =   5
  92.       Top             =   360
  93.       Width           =   2775
  94.    End
  95.    Begin VB.Label lblLabels 
  96.       AutoSize        =   -1  'True
  97.       Caption         =   "(Note:Export is Faster)"
  98.       Height          =   195
  99.       Index           =   3
  100.       Left            =   3360
  101.       TabIndex        =   10
  102.       Top             =   2400
  103.       Width           =   1665
  104.    End
  105.    Begin VB.Label lblLabels 
  106.       AutoSize        =   -1  'True
  107.       Caption         =   " Target Connect String: "
  108.       Height          =   195
  109.       Index           =   2
  110.       Left            =   3045
  111.       TabIndex        =   8
  112.       Top             =   840
  113.       Width           =   1740
  114.    End
  115.    Begin VB.Label lblLabels 
  116.       AutoSize        =   -1  'True
  117.       Caption         =   " Target Database: "
  118.       Height          =   195
  119.       Index           =   1
  120.       Left            =   3045
  121.       TabIndex        =   7
  122.       Top             =   105
  123.       Width           =   1365
  124.    End
  125.    Begin VB.Label lblLabels 
  126.       AutoSize        =   -1  'True
  127.       Caption         =   " Tables: "
  128.       Height          =   195
  129.       Index           =   0
  130.       Left            =   105
  131.       TabIndex        =   6
  132.       Top             =   105
  133.       Width           =   615
  134.    End
  135. Attribute VB_Name = "frmCopyStruct"
  136. Attribute VB_GlobalNameSpace = False
  137. Attribute VB_Creatable = False
  138. Attribute VB_PredeclaredId = True
  139. Attribute VB_Exposed = False
  140. Option Explicit
  141. '>>>>>>>>>>>>>>>>>>>>>>>>
  142. Const FORMCAPTION = "Copy Structure"
  143. Const BUTTON1 = "&OK"
  144. Const BUTTON2 = "&Close"
  145. Const LABEL0 = "Tables:"
  146. Const Label1 = "Target Database:"
  147. Const Label2 = "Target Connect String:"
  148. Const LABEL3 = "(Note: Export is Faster)"
  149. Const CHKBOX1 = "Copy Indexes"
  150. Const CHKBOX2 = "Copy Data"
  151. Const MSG1 = "Copying Table(s)"
  152. Const MSG2 = "Enter New Table Name:"
  153. Const MSG3 = "Copy of Data was Unsuccessful!"
  154. Const MSG4 = "Copy of Structure was Successful!"
  155. '>>>>>>>>>>>>>>>>>>>>>>>>
  156. Private Sub cmdClose_Click()
  157.   RefreshTables Nothing   'just in case some were added
  158.   Unload Me
  159. End Sub
  160. Private Sub Form_Load()
  161.   Dim i As Integer
  162.   Me.Caption = FORMCAPTION
  163.   cmdOK.Caption = BUTTON1
  164.   cmdClose.Caption = BUTTON2
  165.   lblLabels(0).Caption = LABEL0
  166.   lblLabels(1).Caption = Label1
  167.   lblLabels(2).Caption = Label2
  168.   lblLabels(3).Caption = LABEL3
  169.   chkCopyIndexes.Caption = CHKBOX1
  170.   chkCopyData.Caption = CHKBOX2
  171.   RefreshTables lstTables
  172.   txtDatabase.Text = gsDBName
  173.   txtConnect.Text = gdbCurrentDB.Connect
  174.   'select the table that was selected on the database form
  175.   For i = 0 To lstTables.ListCount - 1
  176.     If lstTables.List(i) = gnodDBNode.Text Then
  177.       lstTables.Selected(i) = True
  178.       Exit For
  179.     End If
  180.   Next
  181. End Sub
  182. Private Sub cmdOK_Click()
  183.   Dim i As Integer
  184.   Dim bDifferentDB As Integer
  185.   Dim sToName As String
  186.   Dim dbToDatabase As Database
  187.   On Error GoTo OkayErr
  188.   MsgBar MSG1, True
  189.   Screen.MousePointer = vbHourglass
  190.   If Len(txtDatabase.Text) = 0 Or txtDatabase.Text = gsDBName Then
  191.     Set dbToDatabase = gdbCurrentDB
  192.     bDifferentDB = False
  193.   Else
  194.     Set dbToDatabase = gwsMainWS.OpenDatabase(txtDatabase.Text, False, False, txtConnect.Text)
  195.     dbToDatabase.QueryTimeout = glQueryTimeout
  196.     bDifferentDB = True
  197.   End If
  198.   For i = 0 To lstTables.ListCount - 1
  199.     If lstTables.Selected(i) Then
  200.       If bDifferentDB = False Then
  201.         sToName = InputBox(MSG2)
  202.         If Len(sToName) = 0 Then GoTo SkipIt
  203.       Else
  204.         sToName = (StripConnect(lstTables.List(i)))
  205.       End If
  206.     Else
  207.       GoTo SkipIt
  208.     End If
  209.     Screen.MousePointer = vbHourglass
  210.     If CopyStruct(gdbCurrentDB, dbToDatabase, (StripConnect(lstTables.List(i))), sToName, (chkCopyIndexes)) Then
  211.       If chkCopyData = 1 Then
  212.         If CopyData(gdbCurrentDB, dbToDatabase, (StripConnect(lstTables.List(i))), sToName) = False Then
  213.           Beep
  214.           MsgBox (StripConnect(lstTables.List(i))) & ": " & MSG3, vbInformation, Me.Caption
  215.         End If
  216.       End If
  217.       Screen.MousePointer = vbDefault
  218.       MsgBox (StripConnect(lstTables.List(i))) & ": " & MSG4, vbInformation, Me.Caption
  219.       lstTables.Selected(i) = False
  220.     Else
  221.       Screen.MousePointer = vbDefault
  222.       Beep
  223.       MsgBox (StripConnect(lstTables.List(i))) & ": " & MSG3, vbInformation, Me.Caption
  224.     End If
  225. SkipIt:
  226.   Next
  227.   MsgBar vbNullString, False
  228.   Exit Sub
  229. OkayErr:
  230.   ShowError
  231. End Sub
  232.